public class Test20 {
    public static void main(String[] args) {
        FoodMenu cooker1 =new ChinaCooker();//厨师对象，父类调子类，多态
        Customer customer =new Customer(cooker1);//顾客对象
        customer.order();
    }
}
//顾客类
class Customer{
    private FoodMenu foodMenu;
    //有参，无参构造
    public Customer(){}
    public Customer(FoodMenu foodMenu){
        this.foodMenu =foodMenu;
    }
    //变量读写入口
    public void setFoodMenu(FoodMenu foodMenu) {
        this.foodMenu = foodMenu;
    }

    public FoodMenu getFoodMenu() {
        return foodMenu;
    }
   //方法-调用
    public void order(){
        foodMenu.XiHongShiChaoJiDan();
        foodMenu.DeZhouPaJi();
    }
}
//接口-菜单
interface  FoodMenu{
    void XiHongShiChaoJiDan();
    void DeZhouPaJi();
}
//中国厨师类
 class ChinaCooker implements FoodMenu{//实现接口
    public void XiHongShiChaoJiDan(){
        System.out.println("中国厨师在做西红柿炒鸡蛋");
    }
    public void DeZhouPaJi(){
        System.out.println("中国厨师在做德州扒鸡");
    }
}
//西餐厨师类
class AmerIcCooker implements FoodMenu{//实现接口
    public void XiHongShiChaoJiDan() {
        System.out.println("西餐厨师在做西红柿炒鸡蛋");
    }
    public void DeZhouPaJi() {
        System.out.println("美国厨师在做德州扒鸡");
    }
}

